package com.mydesignpattern.beijing.responsibilitychain.middle.impl;

import com.mydesignpattern.beijing.responsibilitychain.middle.*;

/**
 * 处理html标签的实现类
 * Created by nevermore on 17/4/25.
 */
public class HtmlFilter implements Filter {
    @Override
    public void doFilter(Request request, Response response, FilterChain filterChain) {
        //以"<>"替换为"[]"代替
        System.out.println("htmlfilter 处理request");
        request.setRequestStr(request.getRequestStr().replace("<", "[").replace(">", "]"));
        filterChain.doFilter(request,response,filterChain);
        System.out.println("htmlfilter response");
        response.setResponseStr(response.getResponseStr().replace("<", "[").replace(">", "]"));
    }
}
